import 'package:eye_flutter_app/iconfont/iconfont.dart';
import 'package:eye_flutter_app/iconfont/icon_font_svg.dart'; // 使用多彩图标
import 'package:eye_flutter_app/utils/svg_tool.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class IconDemo extends StatelessWidget {
  const IconDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // 使用Text的方式
    String icons = "";
// accessible: 0xe03e
    icons += "\uE03e";
// error:  0xe237
    icons += " \uE237";
// fingerprint: 0xe287
    icons += " \uE287";

    // const String assetName = 'assets/images/Account.svg';
    // final Widget svg = SvgPicture.asset(assetName, semanticsLabel: 'Acme Logo');

    final Widget networkSvg = SvgPicture.network(
      'https://site-that-takes-a-while.com/image.svg',
      semanticsLabel: 'A shark?!',
      placeholderBuilder: (BuildContext context) => Container(
          padding: const EdgeInsets.all(30.0),
          child: const CircularProgressIndicator()),
    );

    return Scaffold(
      appBar: AppBar(
        title: Text('icon'),
      ),
      body: ListView(
        children: <Widget>[
          Text('text方式'),
          Text(
            icons,
            style: TextStyle(
              fontFamily: "MaterialIcons",
              fontSize: 24.0,
              color: Colors.green,
            ),
          ),
          Text('封装成iconfont.dart方式'),
          Icon(
            IconFont.icon_AIcchufaliebiao,
            size: 32,
          ),
          Icon(IconFont.icon_shanchu),
          Icon(IconFont.icon_gerenxinxi),
          EyeIconFont(IconNames.icon_password, size: 100),
          // svg,
          // networkSvg,
          SizedBox(
            width: 80,
            height: 80,
            child: SvgTool.render('assets/images/Account.svg'),
          )
        ],
      ),
    );
  }
}
